<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>模块和权限</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui-v2.6.8/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <script type="text/html" id="toolbar">
            <div><i class="layui-icon layui-icon-vercode"></i> 管理后台全部模块，及各模块的操作权限。</div>
        </script>

        <table class="layui-hide" id="id_module" lay-filter="currentTableFilter"></table>

    </div>
</div>
<script src="/lib/layui-v2.6.8/layui.js" charset="utf-8"></script>
<script src="/js/lay-config.js?v=2.0.0" charset="utf-8"></script>
<script>
    layui.use(['table'], function () {
        var $ = layui.jquery,
            table = layui.table;

        $.get('/admin/user/getCurrent', {}, function (re) {
            if (re.code == 0) {
                layui.use('watermark', function (watermark) {
                    watermark({watermark_txt: re.data.name});
                });
            }
        }, 'json');

        table.render({
            elem: '#id_module',
            url: '/admin/page/moduleAndActions',
            toolbar: '#toolbar',
            defaultToolbar: ['filter', 'exports', 'print'],
            request: {},
            done: function () {
                $('body, html').animate({
                    scrollTop: 0
                }, 100);
            },
            cols: [[
                {field: 'module', width: 300, title: '模块'},
                {title: '权限', templet: function (row) {
                    let html = '';
                    for (let i in row.actions) {
                        html += ' / ' + row.actions[i];
                    }
                    return html + ' /';
                }}
            ]],
            page: false,
            skin: 'line',
            width: 900
        });
    });
</script>

</body>
</html>